package com.mingte.manghe.controller;

import com.mingte.manghe.common.ResponseResult;
import com.mingte.manghe.service.MailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：luxinsheng
 * @Email ：282860642@qq.com
 * @date ：Created in 2021/12/15 12:05
 * @description：邮件发送
 * @modified By：
 * @version: $
 */
@Api(tags = {"邮件管理"})
@RestController
@RequestMapping("/email")
public class MailController {

    @Autowired
    private MailService mailService;

    /**
     * 发送一条消息
     * @param msg
     * @return
     */
    @ApiOperation(value="发送一条消息")
    @RequestMapping(value = "/sendMsg", method = RequestMethod.POST)
    public ResponseResult findUserByUserName(@RequestBody @ApiParam String msg) {
        int i = mailService.sendMsgToMq(msg);
        return i > 0 ? ResponseResult.success() : ResponseResult.fail();
    }

}